﻿using GameServer.Database;
using GameServer.Mgr;
using Proto;
using Serilog;
using Summer;
using Summer.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Model
{
    //角色
    public class Character : Actor
    {
        //当前角色的客户端连接
        public Connection conn;
        //当前角色对应的数据库对象
        public DbCharacter Data; 

        public Character(Vector3Int position, Vector3Int direction) : base(position, direction)
        {
            
        }

        
   
        public static implicit operator Character(DbCharacter r)
        {

            Character c = new Character(new Vector3Int(r.X, r.Y, r.Z), Vector3Int.zero);
            c.Id = r.Id;
            c.Name = r.Name;
            c.Info.Id = r.Id;
            c.Info.Name = r.Name;
            c.Info.TypeId = r.JobId; //角色类型
            c.Info.Level = r.Level;
            c.Info.Exp = r.Exp;
            c.Info.SpaceId = r.SpaceId;
            c.Info.Gold = r.Gold;
            c.Info.Hp = r.Hp;
            c.Info.Mp = r.Mp;
            c.Data = r;
            return c;
        }

    }
}
